import Vue from "vue";
// import VueRouter from 'vue-router'
import VueRouter from "../vue-router";
import HomeView from "../views/HomeView.vue";
import AboutView from "../views/AboutView.vue";
import A from "../views/a.vue";
Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    name: "home",
    component: HomeView,
    // children:[
    //   {
    //     path: 'about',
    //     name: 'about',
    //     component: AboutView,
    //   }
    // ]
  },
  {
    path: "/about",
    name: "about",
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: AboutView,
    children: [
      {
        path: "a",
        name: "a",
        component: A,
      },
    ],
  },
];

const router = new VueRouter({
  mode: "history",
  routes,
});
router.beforeEach((to, from, next) => {
  next();
});
// router.matcher.addRoutes([
//   {
//     path: '/about1',
//     name: 'about1',
//     component: () => import('../views/AboutView.vue')
//   }
// ])
export default router;
